1
Variable Foundations and Naming Conventions
AI015 Lesson 2
00:00

Variable foundation in Julia centers on the principle of Type Inference. Unlike languages like C++, Julia automatically deduces the data type from the assigned value, providing a script-like experience with compiled performance.

1. Lexical Rules & Sensitivity

Julia identifiers are strictly case-sensitive. A variable named marks is distinct from Marks. All variable names must begin with a letter; subsequent characters can include digits, letters, or underscores.

2. The Snake Case Convention

Following Julia’s style guide, developers use lowercase names with words separated by underscores (snake_case) for multi-word variables to maintain consistency.

✅ student_name (Correct: Letter start, snake_case)❌ 2nd_roll (Incorrect: Starts with digit)

3. Julia vs. Static Languages

In Julia, we do not specify types. The compiler infers that 9.5 is a Float64 automatically.

C++ (Explicit)
int roll = 15;
Julia (Inferred)
roll = 15

4. Environment & Execution

To run scripts, use include("filename.jl"). To set up your environment, you can add packages like IJulia (for Jupyter), PyPlot, or use IDEs like Atom and Juno.

main.py
TERMINAL bash — 80x24
> Ready. Click "Run" to execute.
>